DAILY_CHN_REPORT = {
    'dynamic_argument': True,
    'real_time_report': True,
    'group_by': '_chn.keyword',
    'target_event_id': ['register', 'bind', 'recharge', 'bet_order', 'withdraw'],
    'values': [
        {
            "value_id": "register_count",
            "target_value": "_user_id",
            "value_name": "激活",
            "filter": [
                {"term": {"_event_id": "register"}}
            ],
            "operation": "cardinality"
        },
        {
            "value_id": "bind_count",
            "target_value": "_user_id",
            "value_name": "注册",
            "filter": [
                {"term": {"_event_id": "bind"}}
            ],
            "operation": "cardinality"
        },
        {
            "value_id": "first_recharge_user",
            "target_value": "_user_id",
            "value_name": "首充账号",
            "filter": [
                {"term": {"_event_id": "recharge"}},
                {"terms": {"_user_id": "${first_recharge_user_pool}"}}
            ],
            "operation": "cardinality"
        },
        {
            "value_id": "first_recharge_count",
            "target_value": "recharge_price",
            "value_name": "首充金额",
            "filter": [
                {"term": {"_event_id": "recharge"}},
                {"terms": {"_user_id": "${first_recharge_user_pool}"}},
                {"terms": {"recharge_out_trans_id": "${first_recharge_out_trans_id}"}}
            ],
            "value_type": "float"
        },
        {
            "value_id": "recharge_new_user",
            "target_value": "_user_id",
            "value_name": "新充值账号",
            "filter": [
                {"term": {"_event_id": "recharge"}},
                {"term": {"_is_new_user": 1}}
            ],
            "operation": "cardinality"
        },
        {
            "value_id": "recharge_new_amount",
            "target_value": "recharge_price",
            "value_name": "新充金额",
            "filter": [
                {"term": {"_event_id": "recharge"}},
                {"term": {"_is_new_user": 1}}
            ],
            "value_type": "float"
        },
        {
            "value_id": "recharge_amount",
            "target_value": "recharge_price",
            "value_name": "充值金额",
            "filter": [
                {'term': {'_event_id': 'recharge'}},
            ],
            "value_type": "float"
        },
        {
            "value_id": "recharge_user",
            "target_value": "_user_id",
            "value_name": "充值账号",
            "filter": [
                {'term': {'_event_id': 'recharge'}},
            ],
            "operation": "cardinality",
        },
        {
            "value_id": "online_recharge",
            "target_value": "recharge_price",
            "value_name": "在线充值",
            "filter": [
                {'term': {'_event_id': 'recharge'}},
            ],
            "not_filter": [
                {'terms': {'recharge_sub_type.keyword': ['agency_pay', 'mf_pay']}},
            ],
            "value_type": "float"
        },
        {
            "value_id": "agency_recharge",
            "target_value": "recharge_price",
            "value_name": "代理充值",
            "filter": [
                {'term': {'_event_id': 'recharge'}},
                {'terms': {'recharge_sub_type.keyword': ['agency_pay', 'mf_pay']}},
            ],
            "value_type": "float"
        },
        {
            "value_id": "withdraw_amount",
            "target_value": "withdraw_real_price",
            "value_name": "提现",
            "filter": [
                {'term': {'_event_id': 'withdraw'}}
            ],
            "value_type": "float"
        },
        {
            "value_id": "true_profit",
            "value_name": "营收",
            "value_expr": "recharge_amount - withdraw_amount"
        },
        {
            "value_id": "tax_amount",
            "target_value": 'bet_order_tax_amount',
            "value_name": "税收金额",
            "filter": [],
            "value_type": "float"
        },
        {
            "value_id": "high_level_fish_bet_amount",
            "target_value": 'bet_order_bet_amount',
            "value_name": "高级鱼房投注金额",
            "filter": [
                {"term": {"bet_order_sub_type.keyword": "fish"}},
                {"terms": {"bet_order_third_type.keyword": ["fish_3", "fish_4", "3", "4"]}}
            ],
            "value_type": "float",
            "hide_result": True
        },
        {
            "value_id": "channel_tax_amount",
            "value_name": "渠道税收",
            "value_expr": "tax_amount + high_level_fish_bet_amount * 0.015"
        },
        {
            "value_id": "_level_fish_bet_amount",
            "target_value": 'bet_order_bet_amount',
            "target_index": ["dark3", 'dark4'],
            "value_name": "非初级鱼房投注金额",
            "filter": [
                {'term': {'_event_id': 'bet_order'}},
                {"term": {"bet_order_sub_type.keyword": "fish"}},
                {"terms": {"bet_order_third_type.keyword": ["fish_2", "fish_3", "fish_4", "2", "3", "4"]}}
            ],
            "value_type": "float",
            "hide_result": True,
        },
        {
            "value_id": "_shz_bet_amount",
            "target_value": 'bet_order_bet_amount',
            "target_index": ["dark3", 'dark4'],
            "value_name": "水浒传投注金额",
            "filter": [
                {'term': {'_event_id': 'bet_order'}},
                {"term": {"bet_order_sub_type.keyword": "shz"}}
            ],
            "value_type": "float",
            "hide_result": True
        },
        {
            "value_id": "real_channel_tax_amount",
            "target_index": ["dark3", 'dark4'],
            "value_name": "渠道真实税收",
            "value_expr": "tax_amount + _level_fish_bet_amount * 0.05 + _shz_bet_amount * 0.05"
        },
    ]
}
